/*
 *  Copyright (C) 2011 Hatsites
 * 
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 * 
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

package org.myorg.ctm.etk.gui.swg.display.choosepass;

import org.myorg.ctm.etk.gui.swg.display.choosepass.button.BtnCmdOkAdmin;
import java.awt.event.ActionListener;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import org.myorg.ctm.etk.gui.swg.display.choosepass.button.BtnCmdCancelAdmin;
import org.myorg.shr.gui.swg.display.frame.FrmAbs;

/**
 *
 * @author Hatsites
 *
 * email: Hatsites_AT_gmail.com
 * ... please remove "_AT_" from the above string to get the right email address
 */

public class FrmChooseAdminLogin extends FrmAbs {
    public FrmChooseAdminLogin(ActionListener alr) {
        super();

        this._psfAdminFirst_ = new JPasswordField();
        this._psfAdminConfirm_ = new JPasswordField();
        this._btnOk_ = new BtnCmdOkAdmin(alr);
        this._btnCancel_ = new BtnCmdCancelAdmin(alr);
        this._lblWhat_ = new JLabel("Choisir un mot de passe administrateur:");
        this._lblWhy_ = new JLabel("Attention le choix du mot de passe est important. ");
        this._lblAskPassw_ = new JLabel("Mot de Passe :");
        this._lblConfirmPassword_ = new JLabel("Confirmation :");
        }

    public boolean init(){
        this.setResizable(false);
        this.setLocationRelativeTo(this.getParent());


        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(100, Short.MAX_VALUE)
                .addComponent(this._btnCancel_)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(this._btnOk_)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(32)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(this._lblWhat_)
                    .addComponent(this._lblWhy_)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(this._lblAskPassw_)
                        .addGap(15)
                        .addComponent(this._psfAdminFirst_, 200, 200, 200))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(this._lblConfirmPassword_)
                        .addGap(15).addComponent(this._psfAdminConfirm_, 200,200,200)))
                .addContainerGap(33, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(this._lblWhy_)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, 20)
                .addComponent(this._lblWhat_)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(this._psfAdminFirst_, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(this._lblAskPassw_)
                    )
                  .addGap(5)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(this._psfAdminConfirm_, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(this._lblConfirmPassword_)
                    )

                .addGap(28, 28, 28)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(this._btnOk_)
                    .addComponent(this._btnCancel_))
                .addContainerGap())
        );
        pack();
        return true;
    }

    private BtnCmdOkAdmin _btnOk_;
    private BtnCmdCancelAdmin _btnCancel_;
    private JLabel _lblWhat_;
    private JLabel _lblWhy_;
    
    private JLabel _lblAskPassw_;
    private JLabel _lblConfirmPassword_;
    
    private JLabel _lblMismatchPassw_;   
    private JPasswordField _psfAdminFirst_;
    private JPasswordField _psfAdminConfirm_;

}
